package com.hospital.hospitalsystem.modules.frontDesk.controller;

import com.hospital.hospitalsystem.base.BaseResponse;
import com.hospital.hospitalsystem.base.PageData;
import com.hospital.hospitalsystem.config.TokenVerify;
import com.hospital.hospitalsystem.modules.frontDesk.biz.FrontDeskBiz;
import com.hospital.hospitalsystem.modules.frontDesk.dto.DeleteOrderReq;
import com.hospital.hospitalsystem.modules.frontDesk.dto.SearchOrderListRsp;
import com.hospital.hospitalsystem.modules.frontDesk.dto.SearchOrderReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author qiancheng@cqxyy.net
 * @date 2023/3/30
 */
@RestController
@RequestMapping("/front-desk")
@Api(tags = "前台管理")
@Validated
public class FrontDeskController {

    @Autowired
    private FrontDeskBiz frontDeskBiz;

    @ApiOperation(value = "前台查看预约信息")
    @RequestMapping(path = "/get-book",method = RequestMethod.POST)
    @TokenVerify(type = "frontDesk")
    public BaseResponse<PageData<SearchOrderListRsp>> getBook(@RequestBody SearchOrderReq req){
        PageData<SearchOrderListRsp> result = frontDeskBiz.getBook(req);
        return BaseResponse.success(result);
    };

    @ApiOperation(value = "前台更新预约信息")
    @RequestMapping(path = "/update-book",method = RequestMethod.POST)
    @TokenVerify(type = "frontDesk")
    public BaseResponse updateBook(@RequestBody SearchOrderReq req){
        frontDeskBiz.updateBook(req);
        return BaseResponse.success();
    };

    @ApiOperation(value = "前台删除预约信息")
    @RequestMapping(path = "/delete-book",method = RequestMethod.POST)
    @TokenVerify(type = "frontDesk")
    public BaseResponse deleteBook(@RequestBody DeleteOrderReq req){
        frontDeskBiz.deleteBook(req);
        return BaseResponse.success();
    };
}
